<%@ page import="com.conversationboard.model.*" %>
<%@ page import="com.conversationboard.config.*" %>
<%@ page import="com.conversationboard.site.*" %>
<%@ page import="java.security.Principal" %>
<%@ page import="com.conversationboard.controller.confirm.Confirm" %>
<%@ page import="com.conversationboard.view.MainMenu"%>

<%@ page pageEncoding="UTF-8"%>
<%@ page contentType="text/html;charset=UTF-8"%>

<%
    Principal principal = request.getUserPrincipal();
    String userName = null;
    
    if (principal!=null) {
    	userName = principal.getName();
    }
%>


<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
		<title>Allow Registrations</title>
		<link rel="stylesheet" type="text/css" href="<%=Configuration.getInstance().getRoot()%>/Stylesheets/<%=StyleSheets.getStyleSheetFileName(request.getCookies())%>"/>
	</head>

	<body>
	
		<%= MainMenu.display(request.getUserPrincipal()) %>

		<div class="headingblock">
			<h1>New Registrations</h1>
		</div>

		<div class="mainblock">
			
			<form class="formsection" action="<%=Configuration.getInstance().getRoot()%>/Admin/AdminRegistrationStatusControllerServlet" method="post">

			<p>By default, the site allows registrations by users, who are immediately sent an email address. If
			   persistent troublemakers are causing problems, then close the site to automatic registration and
			   registrations will be held pending until a site admin OKs them, using the 'Review Pending Registrations'
			   option.
			<p>

			<strong>			
			<% if (Site.isRegistrationAllowed()) { %>
			Site is currently open to new registrations.
			<%} else {%>
			Registrations currently require authorisation by site admins.
			<% } %>
			</strong>
			
			</p>

			 	<%= Confirm.getKey(userName) %>
		
				<% if (Site.isRegistrationAllowed()) { %>
				 	<input type="submit" value="Turn on Authorisation of Registrations" />
				<%} else {%>
				 	<input type="submit" value="Turn off Authorisation of Registrations" />
				<% } %>

			</form>

		</div>

		<!--<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"></script>-->
		<!--<script type="text/javascript">_uacct = "UA-1148679-1";urchinTracker();</script>--> 

	</body>
	
</html>
